package plugins

import (
	"golang.org/x/crypto/bcrypt"
)

type PasswordManager struct{}

func (p *PasswordManager) TransformStringToPassword(password string) (string, error) {
	bytes, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
	return string(bytes), err
}

func (p *PasswordManager) VerifyIsEquality(password string, hash string) error {
	// fmt.Printf("pass : %s, hash: %s", password, hash)
	err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
	return err
}
